home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
3565-4.665
/
dmg-4385
/
issue_10
/
12.pne
< prev
next >
Wrap
Text File
|
1987-04-21
|
5KB
|
182 lines
WRITING STOS EXTENSIONS - PART 3 of 3
=====================================
By Martin Cubitt for STOSSER disczine
This is the last part of this mini-series about writing STOS extensions.
When you have written and tested your interpreter and compiler extensions
you may consider writing an installation program to make it easier for
users to install your extension into their STOS work disc. It also looks
more professional.
I have written a small example of such a program.
My usual header...
10 rem EG extension installer
20 rem By Martin Cubitt
30 rem 15th October 1993
40 rem
50 rem Last update: 17/10/1993
60 rem
Work in mode 0 to gain more colours.
100 curs off : palette $0,$0,$0,$0,$0 : mode 0 : key off : hide :
flash off
Display options.
110 pen 7
120 paper 8
130 centre " EG extension installer "
140 pen 9
150 paper 0
160 locate 0,5
170 centre "Select from one of the following"
180 pen 4
190 paper 6
200 locate 0,10
210 centre " 1. Install INTERPRETER extension "
220 locate 0,12
230 centre " 2. Install COMPILER extension "
240 locate 0,15
250 centre " 9. Exit "
260 pen 9
270 paper 0
280 locate 0,19
290 centre "Press the number of your choice"
300 wait vbl
Set palette once screen writing complete.
310 palette $113,$777,$0,$0,$632,$273,$321,$362,$231,$557,$666,$333
320 clear key
Wait for option number to be pressed from one of 3 defined.
330 repeat
340 : OPTION=instr("129",inkey$)
350 until OPTION>0
Jump to line depending on option selected.
360 on OPTION goto 1000,2000,9000
Install interpreter...
998 rem --------------------------------------------------------
999 rem * INSTALL: Interpreter extension *
Sets up file name to save, size of file to be saved, memory bank
where extension is and the folder for the extension.
1000 FILENAME$="eg.exw"
1010 FILESIZE=691
1020 BANK=5
1030 FOLDNAME$="STOS"
1040 gosub 3000
1050 goto 320
Install compiler...
1998 rem --------------------------------------------------------
1999 rem * INSTALL: Compiler extension *
2000 FILENAME$="eg.ecw"
2010 FILESIZE=318
2020 BANK=6
2030 FOLDNAME$="COMPILER"
2040 gosub 3000
2050 goto 320
Actual routine to install...
2998 rem --------------------------------------------------------
2999 rem * INSTALL: An extension *
Ensure file name in upper case.
3000 FILENAME$=upper$(FILENAME$)
3010 pen 11
3020 locate 0,23
3030 centre "Enter EXIT not to install "+FILENAME$
3040 pen 10
3050 paper 0
3060 MSG$="Select "+FOLDNAME$+" folder"
Allow selection of disc and path.
3070 show
3080 SELECT$=file select$("*.*",MSG$)
3090 hide
3100 locate 0,23
Clear previous message.
3110 centre space$(len("Enter EXIT not to install "+FILENAME$))
If EXIT entered abort s`install and go back to main menu.
3120 if upper$(SELECT$)="EXIT" then 3160
Catch all errors.
3130 on error goto 3500
Save (install) extension.
3140 bsave FILENAME$,start(BANK) to start(BANK)+FILESIZE
3150 on error goto 0
3160 return
In case of error make loud noise and try again.
3499 rem Error, just return to folder select
3500 on error goto 0
3510 resume 3520
3520 boom
3530 goto 3070
End of program, no frills!
8999 rem --------------------------------------------------------
9000 default
9010 end
This was a particularly simple example. You may wish to also include a
manual document with your extension explaining in detail what the commands
can do. Save this to another bank and treat much like an interpreter or
compiler extension.
You may also wish to add fancy graphics or music. The current install
program for my EXTRA extension (version 1.87 at time of writing) has a
serious problem when exiting. It seems to the size of the sample combined
with what the program does that causes problems. Some versions before 1.87
had a major problem with the installer in that it would not quite run on a
half meg machine! I have to admit this is a little crazy when the bells
and whistles of a program (unnecessary to its functioning) cause it not to
work. I have reduced the sampled sounds and it now runs on a half meg from
the AUTO folder.
So keep your installer pretty but do not overdo it. More error detection
could be applied to my example and a check to see of disc memory id free
and if the file already exists to give a confirmation of the overwrite.
I hope that this series has been of some use to you all. Any problems can
be directed to me but I admit openly that my knowledge of STOS extensions
is very limited. As I have said many times before, contact Mandarin for
definite instructions.
Good luck, I hope to see extensions cropping up from all areas now.
Remember, don't mix extensions id's and please do not create an extension
(such as this) with only a few commands on. It is a waste of an entire
extension.
By the way, I do not expect people to keep this extension on their STOS
discs so the W id is still free!
Martin.